/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PlanFrame.java
 *
 * The window that contains Insert/Merge Plan.
 *
 * --- Last Update: 5/18/2010 1:41 AM ---
 *
 * Update Notes 5/18/2010 1:41 AM by Adrian Wijasa:
 * Now throws ColumnNotConfiguredException.
 *
 * Update Notes 4/18/2010 1:27 PM by Adrian Wijasa:
 * This class is made to work with Java 5.
 *
 * Created on Apr 15, 2010, 10:05:20 PM
 *
 * CSV Loader
 * Copyright 2007, 2009, 2010 Adrian Wijasa
 *
 * This file is part of CSV Loader.
 *
 * CSV Loader is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * CSV Loader is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with CSV Loader.  If not, see <http://www.gnu.org/licenses/>.
 */

package forms;

import csv.ColumnNotConfiguredException;
import panels.DataComparisonPanel;
import panels.PlanPanel;
import java.sql.SQLException;

/**
 *
 * @author matianyuan
 */
public class PlanFrame extends javax.swing.JFrame {

    /** Creates new form PlanFrame */
    public PlanFrame( Main main ) throws ClassNotFoundException, ColumnNotConfiguredException, SQLException {
        this.main = main;
        initComponents();
        initTabs();
        setLocation( main.getX(), main.getY() );
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabbedPane = new javax.swing.JTabbedPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Plan");
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 800, Short.MAX_VALUE)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(tabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 776, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 600, Short.MAX_VALUE)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(tabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 576, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        main.setEnabled( true );
        main.requestFocus();
    }//GEN-LAST:event_formWindowClosed

    private void initTabs() throws ClassNotFoundException, ColumnNotConfiguredException, SQLException {
        tabbedPane.addTab( "Plan", new PlanPanel( main ) );
        tabbedPane.addTab( "Data Comparison", new DataComparisonPanel( main ) );
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane tabbedPane;
    // End of variables declaration//GEN-END:variables

    private Main main;
}
